package utils;
import java.util.*;
public class StringUtil {

    private static Random random = new Random();

    public static String getString(int minLen, int maxLen, boolean hasBig, boolean hasNum) {
        List<Character> queue = new LinkedList<>();
    
        for (int i = 0; i < 26; i++) {
            queue.add((char)('a' + i));
        }
        if (hasBig) {
            for (int i = 0; i < 26; i++) {
                queue.add((char)('A' + i));
            }
        }
        if (hasNum) {
            for (int i = 0; i < 10; i++) {
                queue.add((char)('0' + i));
            }
        }
        int len = random.nextInt(maxLen - minLen) + minLen;
        int size = queue.size();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < len; i++) {
            sb.append(queue.get(random.nextInt(size)));
        }
        return sb.toString();
    }

    public static String getString(int maxLen) {
        return getString(0, maxLen, false, false);
    }

    public static String getString(int minLen, int maxLen) {
        return getString(minLen, maxLen, false, false);
    }

    public static String getString(int maxLen, boolean hasBig) {
        return getString(0, maxLen, hasBig, false);
    }
    
}
